MAIL page# 0001 next
2: COMMENT ⊗   VALID 00004 PAGES
3: C REC  PAGE   DESCRIPTION
4: C00001 00001
5: C00002 00002    BEGIN  MAIL ↔   SUBTTL MAIL SERVICE.
6: C00005 00003    WRCV:   PUSHJ   P,SRCV
7: C00006 00004     ROUTINE TO GET THE JOB NUMBER OF THE ADDRESSEE
8: C00008 ENDMK
9: C⊗;
    MAIL page# 0002 next  prev
11: BEGIN  MAILSUBTTL MAIL SERVICE.
12: 
13: UMAIL: CAILE   UCHN,MAXMAIL            ;AC FIELD IN BOUNDS?
14:         JRST    UUOERR                  ;NO LOSE.
15:         HRRZ    AC1,UUO                 ;GET THE EFFECTIVE ADDRESS
16:         CAML    AC1,USRREL(PID)         ;IS THIS INSIDE OF USER'S MAXIMUM?
17:         JRST    UUOERR                  ;NO LOSE.
18:         JRST    @MALTBL(UCHN)           ;DISPATCH TO APPROPRIATE ROUTINE
19: 
20: DEFINE UUOS{FOR X IN(SEND,WRCV,SRCV,SKPME,SKPHIM,SKPSEN)}
21: 
22: UUOMAC MALTBL,MAIL
23: MAXMAIL←←UUOCNT-1
24: 
25: SKPSEN: JSP     AC3,GETJOB              ;THIS JSP MUST BE LABELED SKPSEN
26:         JRST    SEND1                   ;ADDRESSEE EXISTS, BEHAVE LIKE "SEND" UUO
27: SEND:   JSP     AC3,GETJOB              ;DAT ← JOB# OF RECEIVING JOB
28: SEND1:  SKIPE   JBTMAIL(DAT)            ;DOES THIS GUY HAVE MAIL ALREADY?
29:         POPJ    P,                      ;YES. CAN'T DO IT.
30:         XCTR    XR,[HRRZ TAC,1(UUO)]    ;GET THE ADDRESS OF THE MAIL BLOCK
31:         MOVEI   AC1,37(TAC)             ;GET ADDRESS OF LAST WORD.
32:         CAMLE   AC1,USRREL(PID)         ;GOD FORBID HE SHOULD SEND MAIL FROM UPPER.
33:         JRST    ADRERR
34:         MOVEI   AC3,40
35:         PUSHJ   P,UFSGET
36:         HRRZM   AC1,JBTMAIL(DAT)
37:         ADDI    TAC,(PROG)
38:         HRL     AC1,TAC
39:         MOVE    AC2,AC1
40:         BLT     AC1,37(AC2)
41:         MOVEI   J,(DAT) 
42:         MOVM    TAC,JOBQUE(J)           ; WAKE HIM UP IF HE IS IN IOWQ
43:         SKIPG   JBTSTS(J)               ; IF NOT RUNNABLE, DON'T REQUE HIM
44:         CAIE    TAC,IOWQ
45:         JRST    NOWAKE
46:         MOVEI   TAC,RUNQ
47:         MOVNM   TAC,JOBQUE(J)
48:         PUSHJ   P,REQUE
49: NOWAKE: MOVSI   AC1,INTMAIL             ; IS HE ENABLED FOR A MAIL INTERRUPT?
50:         AOS     (P)                     ;SET UP SUCCESS RETURN FROM SEND
51:         TDNN    AC1,JBTIEN(J)
52:         POPJ    P,                      ;NO RETURN QUICK
53:         IORM    AC1,JBTIRQ(J)           ; YES, GIVE HIM THE INTERRUPT.
54:         SETOM   INTREQ(PID)
55:         JRST    WSCHED                  ;SHUT US OFF TO GET THE INTERRUPT PROCESSED.
    MAIL page# 0003 next  prev
57: WRCV:   PUSHJ   P,SRCV
58:         TROA    AC1,IOWQ
59:         POPJ    P,
60:         MOVNM   AC1,JOBQUE(J)
61:         PUSHJ   P,WSCHED
62:         JRST    WRCV
63: 
64: SRCV:   SKIPN   AC1,JBTMAIL(J)
65:         POPJ    P,
66:         SETZM   JBTMAIL(J)
67:         HRL     TAC,AC1
68:         HRRI    TAC,@UUO
69:         MOVEI   TAC1,37(TAC)
70:         BLT     TAC,(TAC1)
71:         PUSHJ   P,FSGIVE
72:         JRST    CPOPJ1
73: 
74: SKPME:  SKIPA   DAT,J
75: SKPHIM: JSP     AC3,GETJOB
76:         SKIPN   JBTMAIL(DAT)
77:         POPJ    P,
78:         JRST    CPOPJ1
79: 
    MAIL page# 0004 next  prev
81: ; ROUTINE TO GET THE JOB NUMBER OF THE ADDRESSEE
82: 
83: FNDJOB:                                ;A ROSE BY ANY OTHER NAME, ETC.
84: GETJOB: MOVE    DAT,@UUO                ;GET USER'S ARGUMENT
85:         TDNN    DAT,[-1,,777700]        ;IS IT A NAME?
86:         JRST    GJ1                     ;NO THIS IS A NUMBER
87:         MOVSI   TAC,-JOBN               ;SEARCH ALL JOB NAMES.
88:         CAME    DAT,JOBNAM(TAC)         ;IS THIS ONE?
89:         AOBJN   TAC,.-1                 ;NOT A MATCH. LOOP.
90:         JUMPGE  TAC,GJERR               ;JUMP IF NO NAMES
91:         MOVE    TAC1,TAC                ;CONTINUE SCAN. LOOK FOR ANOTHER
92:         AOBJP   TAC1,GJ2                ;TEST AT TOP OF LOOP. JUMP WHEN DONE
93:         CAME    DAT,JOBNAM(TAC1)        ;SAME NAME?
94:         JRST    .-2                     ;NO. LOOP.
95:         MOVEI   TAC,GTGARP              ;PICKUP THE AMBIGUOUS NAME ERROR MESSAGE
96:         JRST    GJERR1                  ;GO TO ERROR STUFF
97: 
98: GJ2:    MOVEI   DAT,(TAC)               ;GET JOB NUMBER.
99: GJ1:    MOVE    TAC,JBTSTS(DAT)         ;GET JOB STATUS
100:         TLNE    TAC,JNA                 ;IS THIS JOB SLOT ASSIGNED?
101:         JRST    (AC3)                   ;YES. RETURN WITH JOB NUMBER IN DAT
102: GJERR:  MOVEI   TAC,GTGAR1              ;GET ADDRESS OF ERROR ROUTINE
103: GJERR1: HRRZ    AC3,AC3                 ; FIND OUT WHO CALLED GETJOB
104:         CAIN    AC3,SKPSEN+1            ; WAS IT SKPSEN UUO?
105:         JRST    CPOPJ2                  ; YES, TERMINATE THE UUO
106:         PUSHJ   P,HNGMES                ; NO, COME BACK WHEN HE TYPES CONTINUE
107:         JRST    GETJOB                  ; 
108: 
109: GTGAR1: ASCIZ/
110: ?NON-EX JOB NAME OR NUMBER
111:  /
112: 
113: GTGARP: ASCIZ /
114: ?AMBIGUOUS  JOB NAME
115: /
116: BEND
 EOF: MAIL end-of-file. cnt=3